<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <div>
            <button @click="jian">-</button>
            <span>{{cont}}</span>
            <button @click="jia">+</button>
        </div>

        <p>
            单价：{{price}}
        </p>
        <p>
            总价：  {{all}}
        </p>
    </div>
</body>
<script src="./vue.min.js"></script>
<script>
    let vm = new Vue({
        el:"#app",
        data:{
            price:10,
            cont:5
        },
        methods: {
            jian(){
                this.cont--
                console.log(this.cont);
            },
            jia(){
                this.cont++
                console.log(this.cont);

            }
        },
        computed:{
            all(){
                return this.price*this.cont
            }
        }

    })
</script>
</html>